Imports NUnit.Framework
Imports ValidationFramework


Namespace FieldValidationManagerExamples
    Public Class ExternalExample
#Region "Example"
        Public Class Person

            ' Fields
            <RequiredIntRule()> _
            Public age As Integer
        End Class



        <TestFixture()> _
        Public Class ExampleUsage
            ' Methods
            <Test()> _
            Public Sub Run()
                Dim classToValidate As New Person
                Dim fieldValidationManager = ValidationManagerFactory.GetFieldValidationManager(classToValidate)
                'Could have called fieldValidationManager.Validate() here to validate all 
                ' fields
                fieldValidationManager.Validate("age")
                Assert.IsFalse(fieldValidationManager.IsValid)
                classToValidate.age = 99
                ' Could have called fieldValidationManager.Validate() here to validate all 
                ' fields
                fieldValidationManager.Validate("age")
                Assert.IsTrue(fieldValidationManager.IsValid)
            End Sub

        End Class
#End Region
    End Class
End Namespace